package com.jtjrenren.android.taxi.passenger.manger.service;

import android.content.Context;
import android.util.Log;

import com.jtjrenren.android.taxi.passenger.manger.AppManger;
import com.igexin.sdk.GTIntentService;
import com.igexin.sdk.message.GTCmdMessage;
import com.igexin.sdk.message.GTTransmitMessage;
import com.library.utils.StringUtils;

/**
 * Created by wdl on 2017/1/13.
 */

public class PushMsgService extends GTIntentService {
    @Override
    public void onReceiveServicePid(Context context, int i) {

    }

    @Override
    public void onReceiveClientId(Context context, String clientid) {
        AppManger.getInstance().setGtCID(clientid);
    }

    @Override
    public void onReceiveMessageData(Context context, GTTransmitMessage gtTransmitMessage) {
        byte[] payload = gtTransmitMessage.getPayload();

        if (payload != null) {
            String data = new String(payload);
            if (!StringUtils.isEmpty(data))
                AppManger.getInstance().receivePushMsg(data);
        }
    }

    @Override
    public void onReceiveOnlineState(Context context, boolean b) {
        Log.d("push", "online : " + b);
    }

    @Override
    public void onReceiveCommandResult(Context context, GTCmdMessage gtCmdMessage) {

    }
}
